{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ce925641",
   "metadata": {},
   "source": [
    "# 图机器学习\n",
    "由于图数据采用**点**和**线**构成，这导致传统的机器学习并不适用于图数据当中。</br>\n",
    "这时候就引入图机器学习的概念"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "93393568",
   "metadata": {},
   "source": [
    "# 应用场景\n",
    "- 最短路径的搜索和查找（Pathfinding & Search）：高德地图导航\n",
    "- 分析节点重要度（Centrality / Importance）：PageRank算法、网页排名\n",
    "- 社群检测（Community Detection）\n",
    "- 连接预测（Link Prediction）：好友的推荐\n",
    "- 相似度（Similarity）：人物相似性\n",
    "- 图嵌入（Embeddings）：Node2Vec"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ac969030",
   "metadata": {},
   "source": [
    "# 特征分类\n",
    "- 属性特征：Weight、Ranking、Type、Sign、多模态特征（图像、视频、文本、音频）\n",
    "- 连接特征："
   ]
  },
  {
   "cell_type": "markdown",
   "id": "59a115bc",
   "metadata": {},
   "source": [
    "# 学习步骤\n",
    "1. 把节点、连接、全图变成D维向量（特征工程）\n",
    "2. 将D维向量输入到机器学习模型中进行训练\n",
    "3. 给出一个新的图（节点、连接、全图）和特征，进行预测"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "abac159f",
   "metadata": {},
   "source": [
    "# 特征工程分类\n",
    "- 对节点做特征工程\n",
    "- 对连接做特征工程\n",
    "- 对全图做特征工程"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d4df8d6",
   "metadata": {},
   "source": [
    "# 节点层面的特征工程\n",
    "- 主要流程：给出图数据$G=(V,E)$，学习向量表示$f: V \\rightarrow \\mathbb{R}$\n",
    "- 半监督节点分类任务：使用已知节点图，预测未知节点的类别\n",
    "- 节点特征：\n",
    "  - Node degree\n",
    "  - Node centrality（节点重要度）\n",
    "  - Clustering coefficient（聚集系数）\n",
    "  - Graphlets（子图模式）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "705a796f",
   "metadata": {},
   "source": [
    "## Node degree"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cdf170d7",
   "metadata": {},
   "source": [
    "## Node centrality（节点重要度）\n",
    "1. Eigenvector centrality（特征向量中心性）</br>\n",
    "公式：$\\displaystyle c_v = \\frac{1}{\\lambda} \\sum_{u \\in N(v)} c_u$，$v$节点邻居节点的重要度求和,$\\lambda$用于归一化</br>\n",
    "等价求解：$\\lambda c = A c$，求邻接矩阵的特征值和特征向量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3c1974a2",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
